<?php
/**
 * Created by b17
 * 2/17/12 5:37 PM
 */

namespace Managers\TinyMce;

class ImageUploader extends FileUploader
{
    /**
     * @var \Zend_Config
     */
    protected $paramters;

    public function init()
    {
        $this->paramters = \Zend_Registry::get('config')->tinymce->image;
    }

    protected function isValidMime($mimeType)
    {
        return mb_strpos($mimeType, 'image') !== false;
    }

    protected function transform($file)
    {
        $im = new \Imagick($file);
        $im->thumbnailimage($this->paramters->get('width'), $this->paramters->get('height'));
        $im->writeimage($file);
    }
}
